//
//  LGHospitalPlanLineView.m
//  HeartDiseaseManage
//
//  Created by 1234 on 2023/6/28.
//

#import "LGHospitalPlanLineView.h"

@implementation LGHospitalPlanLineView

- (instancetype)initWithFrame:(CGRect)frame{
    self = [super initWithFrame:frame];
    if (self) {
        [self addSubview:self.iconView];
        [self addSubview:self.titleLabel];
        [self addSubview:self.contentTF];
        [self addSubview:self.tipView];
        [self addSubview:self.actionBtn];
    }
    return self;
}

-(void)setShowTip:(BOOL)showTip{
    _showTip = showTip;
    self.tipView.hidden = !showTip;
    self.actionBtn.hidden = !showTip;
    self.contentTF.userInteractionEnabled = !showTip;
}


-(UIImageView *)iconView{
    if(!_iconView){
        _iconView = [[UIImageView alloc]initWithFrame:CGRectMake(viewPix(12), viewPix(16), viewPix(24), viewPix(24))];
    }
    return _iconView;
}

-(UILabel *)titleLabel{
    if(!_titleLabel){
        _titleLabel = [UILabel lableWithText:@"" colorString:@"#333333" textFont:LGFontWeight(16, UIFontWeightMedium) textAlignment:NSTextAlignmentLeft lines:1];
        _titleLabel.frame = CGRectMake(viewPix(42), 0, viewPix(100), viewPix(56));
    }
    return _titleLabel;
}

-(UITextField *)contentTF{
    if(!_contentTF){
        _contentTF = [[UITextField alloc]initWithFrame:CGRectMake(viewPix(130), 0, Screen_W-viewPix(190), viewPix(56))];
        _contentTF.tintColor = [UIColor colorWithString:@"#333333"];
        _contentTF.textColor = [UIColor colorWithString:@"#333333"];
        _contentTF.textAlignment = NSTextAlignmentRight;
        _contentTF.font = LGFont(16);
    }
    return _contentTF;
}

-(UIImageView *)tipView{
    if(!_tipView){
        _tipView = [[UIImageView alloc]initWithImage:[UIImage imageNamed:@"grayTip12"]];
        _tipView.frame = CGRectMake(Screen_W-viewPix(32)-viewPix(24), viewPix(22), viewPix(12), viewPix(12));
    }
    return _tipView;
}

-(UIButton *)actionBtn{
    if(!_actionBtn){
        _actionBtn = [UIButton buttonWithType:UIButtonTypeCustom];
        _actionBtn.frame = CGRectMake(0, 0, Screen_W-viewPix(32), viewPix(56));
    }
    return _actionBtn;
}

@end
